﻿using WeifenLuo.WinFormsUI.Docking;
using Zove.DesignTime;
using Zove.Runtime;
using System.IO;
using System;

namespace Zove.Desktop {
    public partial class PropertiesWindow : DockContent {

        private string name = string.Empty;

        public static PropertiesWindow PropertiesView
        {
            get;
            set;
        }

        public PropertiesWindow() {
            InitializeComponent();
        }

        public PropertiesWindow(string name) {
            this.name = name;

            this.Load += new System.EventHandler(PropertiesWindow_Load);
        }

        public void PropertiesWindow_Load(object sender, EventArgs e) {
            FileInfo i = new FileInfo(name);
            this.Text = i.Name;

            if (i.Extension.ToLower() == ".zoom") {
                ZoomClass zc = ZoveDependencyManager.Instance.ClassLoader.LoadFromFile(name);
                Model model = new Model(zc);
                this.propertyGrid1.SelectedObject = model;
            }
        }
    }
}
